package com.mi.rof.engineer.entity;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zwq
 */
public enum RepairOrderStates {
    //工单已提交
    ORDER_SUBMITTED(100001,"工单已提交"),
    //工单待确认
    ORDER_PENDING_CONFIRM(100002, "工单待确认"),
    //现场确认（分支处理）
    CHECK_CONFIRM(100003, "现场确认"),
    // 工单已接受
    ORDER_ACCEPTED(100004, "工单已接受"),
    //预检 （分支处理）
    PREVIEW(100005, "预检"),
    //物料等待中
    MATERIAL_WAITING(100006, "物料等待中"),
    //物料准备就绪
    MATERIAL_READY(100007, "物料准备就绪"),
    // 工单已撤回
    ORDER_WITHDRAWN(100008, "工单已撤回"),
    // 工单已检修
    ORDER_SERVICED(100009, "工单已检修"),
    //复核结果判断（分支处理）
    CHECK_REVIEWED(100010, "复核结果判断"),
    //工单已复核
    ORDER_REVIEWED(100011, "工单已复核"),
    //工单已完成
    ORDER_COMPLETED(100012, "工单已完成"),
    // 工单结束
    ORDER_ENDED(100013, "工单结束");


    private int code;

    private String msg;

    RepairOrderStates(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }


    public String getMsg() {
        return msg;
    }


    /**
     * 通过code获取枚举类
     */
    private static Map<Integer,RepairOrderStates > stateMap = new HashMap<>();
    static {
        for (RepairOrderStates value : RepairOrderStates.values()) {
            stateMap.put(value.getCode(),value);
        }
    }
    public static RepairOrderStates getByCode(Integer code){
        return stateMap.get(code);
    }

}
